package com.hmdp.common.exception;

import com.hmdp.dto.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author XPQ
 * @date 2024/5/24
 * @func 全局异常处理控制器
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = RuntimeException.class)
    public Result handlerRuntimeException(RuntimeException e) {
        return Result.fail(e.getMessage());
    }

}
